/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-10-14     Administrator       the first version
 */
#ifndef HARDWARE_MOTOR_H_
#define HARDWARE_MOTOR_H_

#include <mypwm.h>
#include <rtthread.h>
#include <board.h>
#include <DAQ.h>
#include <key_check.h>
#include <task.h>

//转向引脚
#define SIGN_PIN   GET_PIN(B,10)

void Motor_Start(rt_uint32_t period,rt_uint32_t pulse, rt_uint8_t SIGN, FunctionalState state);
void MotionDetection (LoadDataFrm pLoad, rt_uint32_t period, rt_uint32_t pulse);
void check(LoadDataFrm pLoad);
void Motor_Stop(void);
//检测状态复位
void DetectionStatusReset(void);
//extern void AutomaticMode (void);
typedef struct MotorData{
    uint32_t period;
    uint32_t pulse;
} MotorData_t;

//上升操作标志
#define StepFalling 1
//下降操作标志
#define StepRasing 2

//正区间
#define LeftValue 0.3
#define RightValue 0.8
//负区间
#define NegativeLeftValue -0.8
#define NegativeRightValue -0.3

extern float Sensitivity;
extern MotorData_t StartData;
#endif /* HARDWARE_MOTOR_H_ */
